<?php
if (!defined('THINK_PATH')) exit;
// 本文档自动生成，仅供测试运行
class msgboardAction extends Action
{
    /**
    +----------------------------------------------------------
    * 默认操作
    +----------------------------------------------------------
    */
    public function index()
    {
    	$mid = getRequest('modid');
    	$modinfo = selectModel::getModInfoById($mid);
    	$content = selectModel::getModConInfoByMid($mid);
//    	var_dump($modinfo);
		$p = new PublicAction();
		$p->recomment();
    	$this->assign('content',$content);
    	$this->assign('modinfo',$modinfo);
    	$this->display();
    }
    public function addmsg(){
    	if(isset($_POST['sub_msg'])){
			$upd['m_name'] = getRequest('name');
			$upd['m_phone'] = getRequest('phone');
			$upd['m_email'] = getRequest('email');
			$upd['m_content'] = getRequest('content');
			if(empty($upd['m_content'])){
				jstop('留言内容不能为空，请重新输入');
			}
			if(empty($upd['m_phone']) && empty($upd['m_email'])){
				jstop('请至少留一种联系方式，谢谢您的合作');
			}
			$upd['m_mid'] = $mid;
			$upd['m_time'] = date('Y-m-d H:i:s');
			$upd['m_ip'] = getIP();
			if(selectModel::insertMsg($upd)){
				jstop('谢谢您的意见及建议，相信有您我们会更好！');
			}
		}
    }
     /*
     +----------------------------------------------------------- 
     * 方法不存在时默认操作
     +-----------------------------------------------------------
     */
	public function _empty(){
		$this->redirect('error');
	}
	/*
     +----------------------------------------------------------- 
     * 错误操作提示
     +-----------------------------------------------------------
     */
	public function error(){
		$this->display('./Tpl/default/Index/error.html');
	}
    /**
    +----------------------------------------------------------
    * 探针模式
    +----------------------------------------------------------
    */
    public function checkEnv()
    {
        load('pointer',THINK_PATH.'/Tpl/Autoindex');//载入探针函数
        $env_table = check_env();//根据当前函数获取当前环境
        echo $env_table;
    }

}
?>